package com.cet.designpatterns.state;

/**
 * @program: algorithm
 * @description: 不能抽奖状态
 * @author: 陈恩涛
 * @create: 2021-09-26 22:08
 **/
public class NoRaffleState extends State {

    private RaffleActivity activity;

    public NoRaffleState(RaffleActivity raffleActivity) {
        this.activity = raffleActivity;
    }

    @Override
    public void deductPoints() {
        System.out.println("扣除50积分成功，您现在可以抽奖了！");
        // 扣除积分后，将状态设置为可以抽奖状态
        activity.setState(activity.getCanRaffleState());
    }

    @Override
    public boolean raffle() {
        //当前状态不能抽奖
        return false;
    }

    @Override
    public void dispensePrize() {
        //当前状态下不能发放奖品
        System.out.println("不能发放奖品");
    }
}
